package se.plingapp.controllerbeans;

import java.util.logging.Logger;
import javax.annotation.ManagedBean;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import org.primefaces.event.FileUploadEvent;

/**
 *
 * @author jensbjork
 */
@ManagedBean
@RequestScoped
public class FileUploadController {

    public void processFileUpload(FileUploadEvent event) throws AbortProcessingException {
        System.out.println("Uploaded: " + event.getFile().getFileName());
        FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
        FacesContext.getCurrentInstance().addMessage(null, msg);
    }
}
